Page({
  data: {
    imgUrls: [
      {
        link:'../study/study',
        url:'https://i.loli.net/2020/06/06/8FcmBj2NWCituEP.png',
        text:'学习区'
      },
      {
        link:'../sport/sport',
        url:'https://i.loli.net/2020/06/06/9vWc8RKXfqyEubm.png',
        text:'运动区'
      },
      {
        link:'../canteen/canteen',
        url:'https://i.loli.net/2020/06/06/8pwmfVWxqMQAsdU.png',
        text:'吃饭区'
      },   
      {
        link:'../person/person',
        url:'https://i.loli.net/2020/06/06/wyBgDbm9W14PSfY.png',
        text:'个人区'
      },   
      {
        link:'../record/record',
        url:'https://i.loli.net/2020/06/06/Co5BGDpr2TY47Ox.png',
        text:'记录区'
      },   
    ],
    current: 0,
    animationData: {},
    animationData2: {}
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.stretch(350)
  },
  onShow:function(options){
    this.setData({
      current: 3,
    })
  },
  change(e) {
    this.setData({
      current: e.detail.current
    })
    this.stretch(500)

    this.shrink(450)
  },
  // 收缩
  stretch(h) {
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease',
    })
    this.animation = animation
    animation.height(h).step()
    this.setData({
      animationData: animation.export(),
    })
  },
  // 展开
  shrink(h) {
    var animation2 = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease',
    })
    this.animation2 = animation2
    animation2.height(h).step()
    this.setData({
      animationData2: animation2.export()
    })
  },
  

})